<?php

namespace App\Models;

class Department extends Base
{
    const STATUS_BEGIN       = 1; //启用
    const STATUS_STOP        = 2; //申请审核

    protected $table = 'wd_system_department';

    /**
     * 获得部门详情的一维数组
     * @return [type] [description]
     */
    public static function getDepartment() {

        $data = self::where('status', self::STATUS_BEGIN)->get();

        if (empty($data)) {
            return [];
        }
        $newArr = [];
        foreach ($data as $key => $value) {
            $newArr[$value->id] = $value->name;
        }

        return $newArr;
    }
}
